home *** CD-ROM | disk | FTP | other *** search
- #this is only the single-messages filter
-
- #$IN = $ARGV[0] eq '' ? "-" : $ARGV[0];
- #open(IN) || die "can't open $IN";
-
- ####require "msgflt.pl";
- #uses $skip, $slave, $nothdr
- #$slave= 1; #is current file slave or main-one
- $skip=0; #state: skipping or no
- $nothdr=0; #recording mode; starts with recording header
-
- sub init { $skip= $nothdr=0; }
-
- sub filtline { #return 1 if line should be skipped
- if (m|\">Back to main board</A>|i) {
- $skip=1;
- # $skip=0 if $skip==1; #stop skipping
- # $skip=1 if $skip==2; #if skipping inside-message mssg-thread
- ### $slave=1;
- ### s|http:.+mbs\.cgi.acct\=mb(\d{6})\"|mb$1.htm\"|;
- # s|<A HREF=\".+mb(\d{6}).*\"|<A HREF=\"mb$1.htm\"|;
- # s|<B>||; s|</B>||;
- }
-
- return 1 if m|<!--|; #skip comments
- return 1 if m|^<blockquote>|; #skip whole heading
- return 1 if m/[^<]<img src="/; #skip any line with pictures
- if (m|\"#POSTNEW\"|) { $nothdr++; return 1; } #skip goto-post-new-message
-
- #skip listbox-menu-header:
- return 1 if m|javascript:if\(confirm\(\'|; #works if teleportPro used #http://www.insidetheweb.com/
- return 1 if m|[^<]<option|; #skip listbox-menu-0
- return 1 if m|^<option|; #skip listbox-menu
- return 1 if m|[^<]<input type=\"submit\"|; #skip listbox-menu-footer
-
- if (m|</SCRIPT>|) { $skip = 0; return 1; } #end skipping javascript
- if (m|</body>|) { $skip = 0; } #end skipping everything NOW
-
- $skip=1 if m|<SCRIPT language=\"javascript\">|; #start skipping javascript
- # $skip=1 if m|<FORM ACTION=|; #start skipping newmsg form
- $skip=1 if m|<center><table border=3><tr><td>|; #start skipping newmsg form
- $skip=2 if m|[^>]>Message thread:<|i; #start skipping thread-view
-
- $skip=0 if m|</head>|i; #stop skipping
-
- return 1 if $skip;
- $skip=1 if m|>Back to main board</A>|; #start skiping again/new-mssg table
- # $skip=1 if m|^ *</TITLE>|i; #start skiping after eo title
- $skip=1 if m|[^<]</TITLE>|i; #start skiping after eo title
- return 1 if /<title>/i; #skip title also
- s|<font [^>]*>||gi; s|</font>||gi;
- s|</*head>||gi;
- s|</a>||gi if !/[^<]*<a/i; #there's an hanging /a in ... writes:
- s| TEXT="#......" LINK="#......">|>|i;
- return 1 if $_ eq "\n";
- return 0;
- }
- ###1; #needed by "require()" operator
- ####eo require
-
- #while (<IN>) { #if using (<>) $ARGV is current file's name
- # next if &filtline ; print;
- ## $x = &filtline ; print "$skip:$x:$_";
- #}
- #close IN;
-
- sub filename {
- if ($x eq '') {
- print "$c!!!\n";
- $x = $c;
- $x =~ s/^.*\\//;
- $x =~ s/\..*$//;
- print "$x\n";
- }
- if ($x ne '') {
- $x = ">$x.HTM";
- open(x) || die "$! $x";
- for ($j=0;$j<$i;$j++) { print x $z[$j]; }
- close(x);
- }
- }
-
-
- $x='';
- $c='';
- $i=0;
- while (<>) {
- if (/\"MyNum\"/) {
- $x = $_;
- $x =~ s/<INPUT NAME=\"MyNum\" TYPE=\"hidden\" VALUE=\"//i;
- $x =~ s/\".*\s*//;
- $x = substr($x,-8);
- }
- s/\ \;/ /gi; s/nbsp;//gi;
- s/ *<BR>/<BR>\n/gi; s/\n\n/\n/g;
- # s|<font size=\".{1,2}\">||gi;
- # s|<font size=\".{1,2}\" face=\"arial,helvetica\">||gi;
-
- if (m|^</center>\s*$|i && 5==$nothdr) { $skip=0; $nothdr=0; next; } #stop skiping/topmost listbox
- if (/^<table width=.+ cellpadd/i && !$nothdr) { $skip=1; $nothdr=5; next; }
- s/^<center>\s*$//i;
-
- s|</*p>||gi;
- s|<ul>|<br>|gi; s|</ul>||gi;
- # s|<hr *size=[^>]*>|<hr>|gi; #no hr's
- next if m|^ *<hr *size=[^>]*>|i;
- next if m|^ *<hr>|i;
- s|<TABLE WIDTH=\"100%\"><TR><TD>||gi; s|</TD></TR></TABLE>||gi;
-
- $c = $ARGV if $c eq '';
- if ($c ne $ARGV) {
- &filename;
- $c = $ARGV; $i=0; $x='';
- do init;
- }
-
- #new sectioned fmt/changed things
- if (!&filtline) {
- next if /\d+\.\d+\.\d+\.\d+ writes:<br>/i #NO IPs anymore
- || m|^</body>|
- || m|^</html>|;
- $z[$i++] = $_;
- #new sectioned fmt/changed things
- #start skiping/topmost listbox 1st time only
- }
- }
-
- #for the last one
- &filename;
-